<?php 
$siteSetting = SiteSetting::model()->findAll();
$siteSetting = CHtml::listData($siteSetting, 'key', 'value');

$criteria = new CDbCriteria();
$criteria->limit = 4;
$criteria->order = 'sorter ASC';
$criteria->order = 'date_created DESC';
$product = Product::model()->findAllByAttributes(array('is_feature' => 1, 'status' => 1), $criteria);

$images = ProductImage::model()->findAllByAttributes(array('product_id' => $model->id));
?>
<div class="spotlight">
            <img src="<?php echo Yii::app()->theme->baseUrl ?>/images/cat/1.jpg" alt="Category Image" class="spl-thumb"/>
            <h2 class="spl-info small">Sản phẩm</h2>
        </div><!-- /.spotlight -->
        <div class="main-content container">
            <article id="prd-holder">
                <h2 class="title-bar"><?php echo $model->title ?></h2>
                <div class="prd-content">
                    <dl class="prd-info clearfix">
                        <dt>Ngày tạo:</dt>
                        <dd><?php echo date('d/m/Y', strtotime($model->date_created)); ?></dd>
                        <dt>Loại sản phẩm:</dt>
                        <dd><?php echo $model->productCategory->title ?></dd>
                    </dl>
                    <div class="prd-text">
                        <?php echo $model->content ?>
                    </div><!-- /.prd-text -->
                </div>
                <div id="prd-slider" class="oeSlider">
                	<img src="<?php echo $model->thumbnail ?>" alt="Slide Image"/>
                	<?php if($images): foreach ($images as $i): ?>
                	<img src="<?php echo $i->uri ?>" alt="Slide Image"/>
                	<?php endforeach;endif; ?>
                </div>
                <div class="clear"></div>
            </article><!-- /#prd-content -->
            <div class="home-block">
                <h3 class="title-bar"><a href="#"><?php echo isset($siteSetting['page_title_bar_footer']) ? $siteSetting['page_title_bar_footer'] : 'siteSetting:page_title_bar_footer'; ?></a></h3>
                <div class="hp-house clearfix">
                	<?php if($product): foreach($product as $p): ?>
                    <section class="hp-box">
                        <a href="/product/detail/id/<?php echo $p->id ?>" class="hp-thumb"><img src="<?php echo Yii::app()->baseUrl . $p->thumbnail ?>" alt=""></a>
                        <h2 class="hp-title"><a href="/product/detail/id/<?php echo $p->id ?>"><?php echo $p->title ?></a></h2>
                        <div class="hp-desc">
                            <p><?php echo $p->quote ?></p>
                            <a href="/product/detail/id/<?php echo $p->id ?>" class="hp-btn">Xem thêm</a>
                        </div>
                    </section><!-- /.hp-box -->
                	<?php endforeach;endif; ?>
                </div><!-- /.hp-house -->
            </div>

        </div><!-- /.main-content -->